package com.genius.util.Utils;

import org.springframework.data.redis.core.StringRedisTemplate;

import java.util.Map;
import java.util.concurrent.TimeUnit;

public class RedisUtil {
    public static void saveRedis(Map<String,Object> map, String key, long TTL, TimeUnit timeUnit, StringRedisTemplate stringRedisTemplate){
        stringRedisTemplate.opsForHash().putAll(key,map);
        stringRedisTemplate.expire(key,TTL,timeUnit);
    }

    public static void saveRedis(String json,String key,long TTL,TimeUnit timeUnit,StringRedisTemplate stringRedisTemplate){
        stringRedisTemplate.opsForValue().set(key,json);
        stringRedisTemplate.expire(key,TTL,timeUnit);
    }
}
